/**
 ****************************************************************************
 * Copyright (C) Marcelo F. Ochoa. All rights reserved.                      *
 * ------------------------------------------------------------------------- *
 * This software is published under the terms of the Apache Software License *
 * version 1.1, a copy of which has been included  with this distribution in *
 * the LICENSE file.                                                         *
 */

package com.prism.toolkit;

public class Jxtf extends Object {
    static final String defaultEncoding = "UTF-8";
    static final String defaultContentType = "text/xml";
    static String encoding = null;
    static String contentType = null;

    public Jxtf() {
    }

    public static String ifnotnull(String str1, String str2) {
        if (str1 != null)
            return str1;
        else
            return str2;
    }

    public static String ite(boolean tf, String yes, String no) {
        if (tf)
            return yes;
        else
            return no;
    }

    public static String prolog() {
        return "<?xml version='1.0' encoding='" + encoding + "'?>";
    }

    public static String prolog(String version) {
        return "<?xml version='" + version + "' encoding='" + encoding + "'?>";
    }

    public static String epilog() {
        return "<!-- Toolkit version " + Jxtp.version + " Author: Marcelo F. Ochoa \"mochoa@ieee.org\" -->";
    }

    public static String tag(String name, String value) {
        return "<" + name + ">" + value + "</" + name + ">";
    }

    public static String tag(String name, String value, String attr) {
        return "<" + name + " " + attr + ">" + value + "</" + name + ">";
    }

    public static String tagOpen(String name) {
        return "<" + name + ">";
    }

    public static String tagOpen(String name, String attr) {
        return "<" + name + " " + attr + ">";
    }

    public static String tagClose(String name) {
        return "</" + name + ">";
    }
}
